In the evolving landscape of software deployment and containerization, Docker has emerged as a cornerstone technology for simplifying application setup and management. By encapsulating software and its dependencies into lightweight, portable containers, Docker enables developers and end-users alike to achieve consistent environments across diverse systems. This approach is particularly advantageous for open-source media applications such as SwingMusic, a modern self-hosted music streaming platform designed for both functionality and ease of use.
This article provides a detailed guide to installing SwingMusic using Docker, demonstrating how containerization streamlines the process of deploying a robust and scalable personal music server. Through this method, users can avoid dependency conflicts, ensure reproducible builds, and maintain a clean host system. The following sections outline each step—from pulling the Docker image to configuring persistent storage—providing both practical instructions and conceptual insights into Docker-based deployment.
For this deployment we will be using Docker Compose. Docker Compose is a tool designed to simplify the definition and orchestration of multi-container Docker applications. Rather than managing individual containers through a series of manual commands, Docker Compose utilizes a single declarative configuration file—typically named docker-compose.yml—to specify services, networks, and volumes. This approach enables users to describe complex application architectures in a structured and reproducible manner. By executing a single command, all defined services can be built, configured, and launched simultaneously, significantly reducing setup time and human error.
The advantages of using Docker Compose are multifaceted. It enhances automation by centralizing configuration, promotes consistency across development and production environments, and supports scalability through seamless service replication. Furthermore, it simplifies maintenance and collaboration, allowing teams to share standardized configurations that can be easily version-controlled. In the context of deploying SwingMusic, Docker Compose provides a reliable mechanism to manage the application alongside its dependencies—such as databases, storage volumes, or reverse proxies—ensuring a cohesive and efficient deployment workflow.
For this deployment I am going to be using a Proxmox LXC container but this wright up will also work with a VM on Ubuntu 24.04
The first that that needs to be done is to update the OS
apt update && apt upgrade -y
apt update
/etc/apt/sources.list (and any files under /etc/apt/sources.list.d/).&&
This is a logical operator in Bash.
It means “only run the next command if the previous one succeeds.”
So, apt upgrade -y will only run if apt update completes without errors.
apt upgrade -y
Upgrades all installed packages on the system to the latest versions available in the repositories.
The -y flag automatically answers “yes” to all prompts, so it won’t stop to ask for confirmation.
cURL (short for Client URL) is a command-line tool used to transfer data to or from a server. It supports a wide range of protocols, including HTTP, HTTPS, FTP, and more, making it very versatile for downloading files, testing APIs, or sending data over the web. In practice, cURL is often used to quickly fetch web pages, download installation scripts, or check connectivity between a server and a URL.
apt install curl -y
adduser [username]
adduser [username] sudo
su [username]
curl -sSL https://get.docker.com | sh
curl -sSL https://get.docker.com
Uses cURL to fetch a shell script from Docker’s official website.
The flags mean:
-s → silent mode (hides progress meter and errors unless something goes wrong).
-S → if an error occurs, show it (useful with -s).
-L → follow redirects automatically (in case the URL redirects to another location).
Essentially, this part downloads the official Docker installation script.
| sh
The pipe (|) sends the downloaded script directly into sh (the shell) to be executed immediately.
This means you are running the script without saving it first, which is convenient but can also be risky if you don’t fully trust the source.
When you install Docker, it creates a special user group called docker. By default, only the root user can run Docker commands, which means you’d have to type sudo every time. Adding your user to the docker group lets you run Docker as a normal user without sudo, making it more convenient for everyday use. Keep in mind, though, that this group has root-level access to the system, so you should only add trusted users.
adduser [username] docker
If you’re logged in as your regular user, simply type:
exit
If you switched to root using su, you may need to type exit twice to fully log out.
After that, log back in with your normal user account.
passwd -l root
It’s a good idea to run services under their own user account. Let’s make one called Navidrome:
adduser swingmusic
We’ll need these IDs later for Docker permissions. Run:
id swingmusic
Choose a location (such as your home folder) where you want swingmusic’s files to live.
mkdir swingmusic
cd swingmusic
nano docker-compose.yml
Paste the following starter configuration into the file. This will work as-is, but we’ll improve it in the next step:
version: '3'
services:
swingmusic:
image: ghcr.io/swingmx/swingmusic:latest
container_name: swingmusic
ports:
- "1970:1970"
volumes:
- /home/swingmusic/music/data:/config
- /home/swingmusic/music/music:/music
user: "1001:1001"
restart: unless-stoppedversion: '3'
services:
swingmusic:
image: ghcr.io/swingmx/swingmusic:latest
container_name: swingmusic
ports:
- "1970:1970"
volumes:
- /home/swingmusic/music/data:/config
- /home/swingmusic/music/music:/music
user: "1001:1001"
restart: unless-stoppedmkdir /home/swingmusic/music/
mkdir /home/swingmusic/music/data
mkdir /home/swingmusic/music/music
sudo chown -R 1001:1001 /home/swingmusic/music/
chown
-R
/home/swingmusic/music/, not just the directory itself. 1001:1001
1001 is both the UID and GID of the swingmusic user you created earlier. This ensures that the Navidrome Docker container has the correct permissions to read and write your music files. /home/swingmusic/music/
nano docker-compose.yml
docker compose up -d